﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace STS.Model
{
    [Table]
    public class Osrodek : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("Id");
                    id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private int idOsrodka;

        [Column]
        public int IdOsrodka
        {
            get { return idOsrodka; }
            set
            {
                if (idOsrodka != value)
                {
                    NotifyPropertyChanging("IdOsrodka");
                    idOsrodka = value;
                    NotifyPropertyChanged("IdOsrodka");
                }
            }
        }


        private string nazwa;

        [Column]
        public string Nazwa
        {
            get { return nazwa; }
            set
            {
                if (nazwa != value)
                {
                    NotifyPropertyChanging("Nazwa");
                    nazwa = value;
                    NotifyPropertyChanged("Nazwa");
                }
            }
        }

        private string ulica;

        [Column]
        public string Ulica
        {
            get { return ulica; }
            set
            {
                if (ulica != value)
                {
                    NotifyPropertyChanging("Ulica");
                    ulica = value;
                    NotifyPropertyChanged("Ulica");
                }
            }
        }

        private string nr;

        [Column]
        public string Nr
        {
            get { return nr; }
            set
            {
                if (nr != value)
                {
                    NotifyPropertyChanging("Nr");
                    nr = value;
                    NotifyPropertyChanged("Nr");
                }
            }
        }

        private string kodPocztowy;

        [Column]
        public string KodPocztowy
        {
            get { return kodPocztowy; }
            set
            {
                if (kodPocztowy != value)
                {
                    NotifyPropertyChanging("KodPocztowy");
                    kodPocztowy = value;
                    NotifyPropertyChanged("KodPocztowy");
                }
            }
        }

        private string miasto;

        [Column]
        public string Miasto
        {
            get { return miasto; }
            set
            {
                if (miasto != value)
                {
                    NotifyPropertyChanging("Miasto");
                    miasto = value;
                    NotifyPropertyChanged("Miasto");
                }
            }
        }

        private string telefon;

        [Column]
        public string Telefon
        {
            get { return telefon; }
            set
            {
                if (telefon != value)
                {
                    NotifyPropertyChanging("Telefon");
                    telefon = value;
                    NotifyPropertyChanged("Telefon");
                }
            }
        }

        private string telefon2;

        [Column]
        public string Telefon2
        {
            get { return telefon2; }
            set
            {
                if (telefon2 != value)
                {
                    NotifyPropertyChanging("Telefon2");
                    telefon2 = value;
                    NotifyPropertyChanged("Telefon2");
                }
            }
        }

        private string telefon3;

        [Column]
        public string Telefon3
        {
            get { return telefon3; }
            set
            {
                if (telefon3 != value)
                {
                    NotifyPropertyChanging("Telefon3");
                    telefon3 = value;
                    NotifyPropertyChanged("Telefon3");
                }
            }
        }

        private string email;

        [Column]
        public string Email
        {
            get { return email; }
            set
            {
                if (email != value)
                {
                    NotifyPropertyChanging("Email");
                    email = value;
                    NotifyPropertyChanged("Email");
                }
            }
        }

        private string www;

        [Column]
        public string Www
        {
            get { return www; }
            set
            {
                if (www != value)
                {
                    NotifyPropertyChanging("Www");
                    www = value;
                    NotifyPropertyChanged("Www");
                }
            }
        }

        private double x;

        [Column]
        public double X
        {
            get { return x; }
            set
            {
                if (x != value)
                {
                    NotifyPropertyChanging("X");
                    x = value;
                    NotifyPropertyChanged("X");
                }
            }
        }

        private double y;

        [Column]
        public double Y
        {
            get { return y; }
            set
            {
                if (y != value)
                {
                    NotifyPropertyChanging("Y");
                    y = value;
                    NotifyPropertyChanged("Y");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        public override string ToString()
        {
            return String.Format("Id: {0} Nazwa: {1} IdOsrodka: {2}", Id, Nazwa, IdOsrodka);
        }
    }
}
